<?php
// Accueil center
require_once(PATH_CLASS.'pageContent.class.php');
require_once(PATH_CLASS.'match.class.php');
require_once(PATH_CLASS.'widgets/pageSwitcher.class.php');

/**
 * Description of content
 *
 * @author jpsiffert
 */
class calendrier_middle extends pageContent {
  public function render() {
    
    $matchs = match::getCalendar(null, $_GET['type'], array('order'=>'match_date,match_id'));
    
    if(!is_null($matchs) && !is_null($matchs->compets)){
      ksort($matchs->compets);
    }
    
    $pageSwitcher = array();
    
    pageSwitcher::addSwitcherURL  ($pageSwitcher, '?page=calendrier&type=$1');
    pageSwitcher::addSwitcherParam($pageSwitcher, 'Championnat', 'C');
    pageSwitcher::addSwitcherParam($pageSwitcher, 'Joute-Libre', 'J');
    pageSwitcher::addSwitcher('calendrier', $pageSwitcher);
    
    $ret = $this->fetchTplFromClassFile(__FILE__,array('matchs'=>$matchs));
    return $ret;
  }  
}